package cn.kogee.controller;

import cn.kogee.domian.Student;
import cn.kogee.domian.User;
import cn.kogee.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping
public class Usercontroller {
    @Autowired
    private IStudentService studentService;
    @Value("${server.port}")
    private String port;
    @GetMapping("/getById/{id}")
    public User GetById(@PathVariable("id") Long id){
        return new User(id,"超级柯基","莫斯科....port="+port);
    }

    /**
     * 查询所有
     * @param
     * @return
     */
    @GetMapping
    public List<Student> findAll(){
        return studentService.findAll();
    }
    @GetMapping("/{id}")
    public Student findById(@PathVariable("id") Long id){

        return studentService.findById(id);
    }
}
